var num = 0;
var max = 10;
var interval = null;

function incrementNumber(){
    num++;
    console.log(num)
    if(num == max){
        clearInterval(intervalId);
        console.log('Done')
    }
}
intervalId = setInterval(incrementNumber,500)
